<include file="Public:header"/>
<div class="autobox">
    <div class="now">
        <a href="/" class="orange">首页</a> &gt;
        <a href="/user/index.html" class="orange">安全中心 </a> &gt; 支付宝绑定
    </div>
    <div class="assets_center clear po_re zin70">
        <!--左侧菜单-->
        <include file="User:left"/>
        <!--右侧内容-->
        <div class="assets_content w900 right bg_w">
            <div class="safe_center clear" style="padding-left: 0px; border-bottom: 2px solid #ed4040;">
                <h1 style="margin-top: 0px; margin-bottom: 15px; line-height: 15px;">支付宝绑定</h1>
            </div>

<notempty name="prompt_text">
                    <div class="mytips">
                        <h6 style="color: #ff8000;">温馨提示</h6>
                        {$prompt_text}
                    </div>
                </notempty>
            <br>

            <empty name="user['alipay']">
                <div id="msg-box"></div>
                <form class="pwtrade mart30">
                    <dl>
                        <dt>支付宝账号：</dt>
                        <dd>
                            <input type="text" id="alipay">
                        </dd>
                    </dl>
                    <dl>
                        <dt>交易密码：</dt>
                        <dd>
                            <input type="password" id="paypassword">
                        </dd>
                    </dl>
                    <dl>
                        <dt></dt>
                        <dd>
                            <input type="button" value="绑定支付宝" id="btn-up" onclick="Update()"/>
                        </dd>
                    </dl>
                </form>
                <else/>
                <div class="sj" style="top: 40px; left: 60px;"></div>
                <form id="form-mobilebind" class="pwtrade mart30">
                    <div class="band_succ" style="margin-bottom: 20px;margin-left: 130px;">
                        <em></em>您的账户已绑定支付宝。
                    </div>
                    <dl>
                        <dt>支付宝账号：</dt>
                        <dd title="联系管理员修改">
                            <input type="text" value="{$user.alipay}" readonly>
                        </dd>
                    </dl>
                </form>
            </empty>
        </div>
    </div>
</div>
<br>
<br>
<script>
    $('input').focus(function () {
        var t = $(this);
        if (t.attr('type') == 'text' || t.attr('type') == 'password')
            t.css({
                'box-shadow': '0px 0px 3px #1583fb',
                'border': '1px solid #1583fb',
                'color': '#333'
            });
        if (t.val() == t.attr('placeholder'))
            t.val('');
    });
    $('input').blur(function () {
        var t = $(this);
        if (t.attr('type') == 'text' || t.attr('type') == 'password')
            t.css({
                'box-shadow': 'none',
                'border': '1px solid #e1e1e1',
                'color': '#333'
            });
        if (t.attr('type') != 'password' && !t.val())
            t.val(t.attr('placeholder'));
    });


    function Update() {
        var alipay = $("#alipay").val();
        var paypassword = $("#paypassword").val();


        if (alipay == "" || alipay == null) {
            layer.tips('请输入支付宝账号', '#alipay', {tips: 3});
            return false;
        }

        if (paypassword == "" || paypassword == null) {
            layer.tips('请输入交易密码', '#paypassword', {tips: 3});
            return false;
        }
        $.post("{:U('User/upalipay')}", {
            alipay: alipay,
            paypassword: paypassword
        }, function (data) {
            if (data.status == 1) {
                layer.msg(data.info, {icon: 1});
                window.location = "{:U('User/alipay')}";
            } else {
                layer.msg(data.info, {icon: 2});
                if (data.url) {
                    window.location = data.url;
                }
            }
        }, "json");
    }
</script>
<script>
    //顶部菜单高亮
    $('#user_box').addClass('active');
    $('#user_alipay').addClass('active');
    $('#user_alipay i').attr('class', 'coin_menu_op_6');
</script>
<include file="Public:footer"/>